package cn.tramy.pinxian.wind.handler


class HandleContext private constructor() {

    private val valueMap: MutableMap<String, Any> = mutableMapOf()

    companion object {
        private val contextLocal: ThreadLocal<HandleContext> = ThreadLocal.withInitial {
            HandleContext()
        }

        fun current() = this.contextLocal.get()
    }

    fun putValue(key: String, value: Any) {
        this.valueMap.put(key, value)
    }

    fun getValue(key: String): Any? = this.valueMap[key]

}